home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _BDF8E862B9F4415CA973D768854ACA3E < prev    next >
Encoding:
Text File  |  2003-09-21  |  24.1 KB  |  893 lines

  1. // Variables used in the file
  2. var dateObj = new Date();
  3. var UniqueIDString = "" + dateObj.getTime();
  4. var gsDefaultFramesetCol = "%%%WFT_NAVPANE_SIZE_FOR_COL%%%, *";
  5. var gsDefaultFramesetRow = "%%%WFT_NAVPANE_SIZE_FOR_ROW%%%, *";
  6. // Set the variable for test scenario
  7. if (gsDefaultFramesetRow.substr(0, 2) == "%%") {
  8.     gsDefaultFramesetRow = "300, *";
  9. }
  10. if (gsDefaultFramesetCol.substr(0, 2) == "%%") {
  11.     gsDefaultFramesetCol = "200, *";
  12. }
  13.  
  14. var gsLastFramesetCol = gsDefaultFramesetCol;
  15. var gsCurFramesetCol = gsDefaultFramesetCol;
  16. var gsLastFramesetRow = gsDefaultFramesetRow;
  17. var gsCurFramesetRow = gsDefaultFramesetRow;
  18. var gbVertical = false;
  19. var gsBrowseSequenceInfo = "";
  20. var gsTOCSyncInfo = "";
  21. var gPoweredByWindow = null;
  22. var gnTopicBGColor = 16777215;
  23. var gbSkinLoaded = false;
  24. var gnScrollbarTimerID = -1;
  25. var gnLastScrollbarWidthRequest = 0;
  26. var gnScrollbarDragOffset = 0;
  27. var gnInitialFrameWidth = 0;
  28. var gnInitialXPos = 0;
  29. var IE_FRAMESET_RESIZE_INTERVAL = 300;
  30. var DIV_MOVE_INTERVAL = 30;
  31. var gsFlashVars="";
  32. var gbCommLoaded=true;
  33. var gbNavReloaded=false;
  34. var gbTbReloaded=false;
  35. var gbReloadNavigationOnly = false;
  36. var gbNavPaneLoaded = false;
  37. var gbToolBarLoaded = false;
  38. var gnMouseOver = -1;
  39. var gnMouseMove = -1;
  40. var gnTimeOutXPos = -1;
  41. var gbMouseTimeOut = false;
  42. var gbHasTitle = false;
  43. var gsNavPane = "wf_blank.htm";
  44. var gsParamPasser = "wf_blank.htm";
  45. var gFrameInterval = null;
  46. //const
  47. var CMD_SHOWTOC=1;
  48. var CMD_SHOWINDEX=2;
  49. var CMD_SHOWSEARCH=3;
  50. var CMD_SHOWGLOSSARY=4;
  51.  
  52. function CheckFrameRendered()
  53. {
  54.     clearInterval(gFrameInterval);
  55.     gFrameInterval = setTimeout("RerenderFrames()",2000);
  56. }
  57.  
  58. function RerenderFrames()
  59. {
  60.     var bRerender = true;
  61.     if (window.frames["Content"])
  62.     {
  63.         if (window.frames["Content"].frames)
  64.         {
  65.             if (window.frames["Content"].frames["master"])
  66.             {
  67.                 if (window.frames["Content"].frames["master"].DoCommand)
  68.                 {
  69.                     if (window.frames["comm"])
  70.                     {
  71.                         bRerender = false;
  72.                     }
  73.                 }
  74.             }
  75.         }
  76.     }
  77.     if (!bRerender && !window.frames["Content"].frames["master"].gbSWFLoaded && (gbNavPaneLoaded || gbToolBarLoaded))
  78.     {
  79.         bRerender = true;
  80.     }
  81.  
  82.     if (bRerender)
  83.     {
  84.         window.location.reload();
  85.     }
  86. }
  87.  
  88. // Funtion to send a command to the master HTML file
  89. function SendCmdToMasterHTML(cmd, param1, param2) {
  90.     if ((window.frames["Content"] != null) && 
  91.         (window.frames["Content"].frames["master"] != null) &&
  92.         (window.frames["Content"].frames["master"].DoCommand != null)) 
  93.     {
  94.         window.frames["Content"].frames["master"].DoCommand(cmd, param1, param2);
  95.     }
  96. }
  97.  
  98. function SendCmdToTopic(cmd, param) {
  99.     if ((window.frames["Content"].frames["bottom"] != null) &&
  100.         (window.frames["Content"].frames["bottom"].frames["Topic Pane"] != null) &&
  101.         (window.frames["Content"].frames["bottom"].frames["Topic Pane"].DoCommand != null)) {
  102.         window.frames["Content"].frames["bottom"].frames["Topic Pane"].DoCommand(cmd, param);
  103.     }
  104. }
  105.  
  106. function NavigateToTopic(url, target) {
  107.     target = target + "";
  108.     if ((window.frames["Content"].frames["bottom"] != null) && (window.frames["Content"].frames["bottom"].frames["Topic Pane"] != null))
  109.     {
  110.         if (target == "" || target == null || target == "0")
  111.         {
  112.             if (gbNav4 && !gbNav6) 
  113.             {
  114.                 // For NS 4, we need to use setTimeout. After changing to use fscommand to communicate with NS 4 from Flash,
  115.                 // NS 4 will not perform a change in the URL
  116.                 setTimeout("window.frames['Content'].frames['bottom'].frames['Topic Pane'].location='" + url + "'", 100);
  117.                 
  118.             } 
  119.             else 
  120.             {
  121.                 window.frames["Content"].frames["bottom"].frames["Topic Pane"].location = url;
  122.             }
  123.         }
  124.         else
  125.         {
  126.             if (gbNav4 && !gbNav6) 
  127.             {
  128.                 setTimeout("window.open('" + url + "', '" + target + "','')",100);
  129.             }
  130.             else
  131.             {
  132.                 window.open(url,target,"");
  133.             }
  134.         }
  135.     }
  136. }
  137.  
  138. function getElement(elementID) {
  139.     var element = null;
  140.     // See if the browser supports the functions we need to get to the element
  141.     if (document.getElementById) {
  142.         element = document.getElementById(elementID);
  143.     } else if (document.all) {
  144.         element = document.all(elementID);
  145.     }
  146.     return element;
  147. }
  148.  
  149. function getBottomElement(elementID) {
  150.     var element = null;
  151.     // See if the browser supports the functions we need to get to the element
  152.     if (window.frames["Content"].frames["bottom"].document.getElementById) {
  153.         element = window.frames["Content"].frames["bottom"].document.getElementById(elementID);
  154.     } else if (window.frames["Content"].frames["bottom"].document.all) {
  155.         element = window.frames["Content"].frames["bottom"].document.all(elementID);
  156.     }
  157.     return element;
  158. }
  159.  
  160. function ShowNavigationPane(bShow) {
  161.  
  162.     // Get to the frameset element
  163.     var frameset = getBottomElement("Bottom Frame");
  164.  
  165.     // Show or hide as appropriate
  166.     if (bShow) {
  167.         if (gbVertical) {
  168.             if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  169.                 gsCurFramesetRow = gsLastFramesetRow;
  170.                 RedoBottomFrame(bShow);
  171.             } else if (gbIE) {
  172.                 frameset.rows = gsLastFramesetRow;
  173.             }
  174.         } else {
  175.             if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  176.                 gsCurFramesetCol = gsLastFramesetCol;
  177.                 RedoBottomFrame(bShow);
  178.             } else if (gbIE) {
  179.                 frameset.cols = gsLastFramesetCol;
  180.             }
  181.         }
  182.     } else {
  183.         // "frameset.cols" contains a string of the frameset columns
  184.         // You can get and set this value for Netscape but it doesn't re-render
  185.         // the pages so it looks like it has no effect.
  186.         if (gbVertical) {
  187.             if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  188.                 // For some reason, frameset.rows doesn't work list frameset.cols. So, let's use innerHeight instead.
  189.                 gsLastFramesetRow = "" + window.frames["Content"].frames["bottom"].frames["Navigation Pane"].innerHeight + ", *";
  190.                 gsCurFramesetRow = "0, *";
  191.                 RedoBottomFrame(bShow);
  192.             } else if (gbIE) {
  193.                 window.frames["Content"].frames["bottom"].frames["Navigation Pane"].gbNavClosed = true;
  194.                 if (gbIE6)
  195.                 {
  196.                     gsLastFramesetRow = frameset.rows;
  197.                 }
  198.                 else
  199.                 {
  200.                     gsLastFramesetRow = "" + window.frames["Content"].frames["bottom"].frames["Navigation Pane"].document.body.clientHeight + ", *";
  201.                 }
  202.                 frameset.rows = "0, *";
  203.             }
  204.         } else {
  205.         
  206.             if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  207.                 gsLastFramesetCol = gsCurFramesetCol;
  208.                 gsCurFramesetCol = "0, *";
  209.                 RedoBottomFrame(bShow);
  210.             } else if (gbIE) {
  211.                 gsLastFramesetCol = frameset.cols;
  212.                 frameset.cols = "0, *";
  213.             }
  214.         }
  215.     }
  216.     
  217.     return;
  218. }
  219.  
  220.  
  221. function PrintCurrent() {
  222.     // Give the topic pane the focus and print
  223.     if (gbNav) {
  224.         window.frames["Content"].frames["bottom"].frames["Topic Pane"].print();
  225.     } else {
  226.         window.frames["Content"].frames["bottom"].frames["Topic Pane"].focus();
  227.         window.print();
  228.     }
  229. }
  230.  
  231. function SaveState()
  232. {
  233.     gsTopic = window.frames["Content"].frames["bottom"].frames["Topic Pane"].document.location.href; 
  234. }
  235.  
  236. function RedoBottomFrame(bShow)
  237. {
  238.     // Save the current topic
  239.     SaveState();
  240.     if (gbNavPaneLoaded)
  241.     {
  242.         SendCmdToMasterHTML("CmdNavigationCleanup");
  243.     }
  244.     else
  245.     {
  246.         SendCmdToMasterHTML("CmdNavigationCleanupComplete");
  247.     }
  248. }
  249.  
  250. function ReloadNavigation() {
  251.     gbReloadNavigationOnly = true;
  252.     RedoBottomFrame(false);
  253. }
  254.  
  255. function SetVertical(bVertical) {
  256.     gbVertical = bVertical;
  257. }
  258.  
  259. //////////////////////////////////////////////////////////////////////////////
  260. //
  261. // Frame resizing code
  262. //
  263. // We only want to try to resize the framesets every so often or the browsers
  264. // will fall behind. A timer is set up to achieve this purpose and only the
  265. // last requested size is used when resizing.
  266. //
  267. //////////////////////////////////////////////////////////////////////////////
  268. function BeginMouseCapture()
  269. {
  270.     var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
  271.  
  272.     topicPane.document.onmouseover = MouseOver;
  273. }
  274.  
  275. function MouseOver(e)
  276. {
  277.     var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
  278.     var xMousePos = 0;
  279.  
  280.     if (!e) 
  281.     {
  282.         e = topicPane.window.event;
  283.     }
  284.     
  285.     if (e.x)
  286.     {
  287.         xMousePos = e.x
  288.     }
  289.     else
  290.     {
  291.         xMousePos = e.pageX;
  292.     }
  293.  
  294.     gnMouseOver = xMousePos;
  295.     if (gbOpera && gbMac)
  296.     {
  297.         ScrollbarDragStop(gnMouseOver + gnInitialFrameWidth,0);
  298.     }
  299.     topicPane.document.onmouseover = null;
  300. }
  301.  
  302. function ScrollbarDragStart(x, y) {
  303.     if (gbSafari || (gbMac && gbOpera))
  304.     {
  305.         BeginMouseCapture();
  306.     }
  307.  
  308.     // Calculate how far the mouse is from the edge of the frameset at the beginning
  309.     if (gbNav4) {
  310.         gnInitialFrameWidth = window.frames["Content"].frames["bottom"].frames["Navigation Pane"].window.innerWidth;
  311.     } else {
  312.         gnInitialFrameWidth = window.frames["Content"].frames["bottom"].frames["Navigation Pane"].document.body.clientWidth;
  313.     }
  314.     gnInitialXPos = x;
  315.     gnScrollbarDragOffset = gnInitialFrameWidth - x;
  316.     
  317.     // Record the position
  318.     gnLastScrollbarWidthRequest = x;
  319.  
  320.     // Let the topic know about the start drag if necessary. Calculate the coordinates in the topic coordinate space
  321.     var interval = IE_FRAMESET_RESIZE_INTERVAL;
  322.     if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  323.         var newX = x - gnInitialFrameWidth;
  324.         SendCmdToTopic("CmdScrollbarDragStart", newX);
  325.         interval = DIV_MOVE_INTERVAL;
  326.     }
  327.     
  328.     // Make an initial call to "resize" the frameset
  329.     ResizeFrameset();
  330.  
  331.     // Start a timer that will regulate how often the frameset is "resized"
  332.     gnScrollbarTimerID = setInterval("ResizeFrameset()", interval);
  333. }
  334.  
  335. function MousePos_nsm(e)
  336. {
  337.     var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
  338.     var xMousePos = 0;
  339.  
  340.     if (!e) 
  341.     {
  342.         e = topicPane.window.event;
  343.     }
  344.     
  345.     if (e.x)
  346.     {
  347.         xMousePos = e.x
  348.     }
  349.     else
  350.     {
  351.         xMousePos = e.pageX;
  352.     }
  353.  
  354.     gnMouseMove = xMousePos;
  355.     topicPane.document.onmousemove = null;    
  356. }
  357.  
  358.  
  359.  
  360. function ScrollbarDragStop(x, y) {
  361.     clearInterval(gnScrollbarTimerID);
  362.  
  363.     // Resize for Netscape 7 on a MAC
  364.     if (gbNav7 && gbMac && !gbMouseTimeOut)
  365.     {
  366.         var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
  367.         gnMouseMove = -1;
  368.         topicPane.document.onmousemove = MousePos_nsm;
  369.         gbMouseTimeOut = true;
  370.         gnTimeOutXPos = x;
  371.         setTimeout("ScrollbarDragStop()",1000)
  372.         return;
  373.     }
  374.     else if (gbNav7 && gbMac && gbMouseTimeOut && (gnMouseMove > -1))
  375.     {
  376.         x = gnMouseMove + gnInitialFrameWidth;
  377.         gnLastScrollbarWidthRequest = gnMouseMove + gnInitialFrameWidth;
  378.         gnMouseMove = -1;
  379.         gbMouseTimeOut = false;        
  380.     }
  381.     else if (gbNav7 && gbMac && gbMouseTimeOut)
  382.     {
  383.         x = gnTimeOutXPos;
  384.         gbMouseTimeOut = false;    
  385.     }
  386.  
  387.     // Limit the resize down to zero
  388.     if (x < 0) {
  389.         x = 0;
  390.     }
  391.     
  392.     if (gbSafari && gnMouseOver == -1 && !gbMouseTimeOut)
  393.     {
  394.         gnTimeOutXPos = x;
  395.         gbMouseTimeOut = true;
  396.         setTimeout("ScrollbarDragStop()",50);
  397.         return;
  398.     }
  399.     else if (gbSafari && gbMouseTimeOut)
  400.     {
  401.         x = gnTimeOutXPos;
  402.         gbMouseTimeOut = false;        
  403.     }
  404.  
  405.     gnLastScrollbarWidthRequest = x;
  406.     
  407.     if (gbSafari && gnMouseOver > -1)
  408.     {
  409.         x = gnMouseOver + gnInitialFrameWidth;
  410.         gnLastScrollbarWidthRequest = gnMouseOver + gnInitialFrameWidth;
  411.         gnMouseOver = -1;
  412.     }    
  413.  
  414.     ResizeFrameset();
  415.     
  416.     // Let the topic know about the stop drag if necessary. Calculate the coordinates in the topic coordinate space
  417.     if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  418.         var newX = x - gnInitialFrameWidth;
  419.         SendCmdToTopic("CmdScrollbarDragStop", newX);
  420.     }
  421.     
  422.     // Resize the framesets where necessary
  423.     if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  424.         if (gnInitialXPos != x){
  425.             gsCurFramesetCol = (x+gnScrollbarDragOffset) + ", *";
  426.         }
  427.         RedoBottomFrame(false);
  428.     }
  429. }
  430.  
  431. function ResizeFrameset() {
  432.     if ((gbIE) && (!gbOpera)) {
  433.         // Resize the frames
  434.         var frameWidth = gnLastScrollbarWidthRequest + gnScrollbarDragOffset;
  435.         var frameset = getBottomElement("Bottom Frame");
  436.         frameset.cols = "" + frameWidth + ", *";
  437.     } else if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
  438.         // Let the topic know where to draw its resize bar
  439.         var newX = gnLastScrollbarWidthRequest - gnInitialFrameWidth;
  440.         SendCmdToTopic("CmdScrollbarDragMove", newX);
  441.     }
  442. }
  443.  
  444. function ScrollbarDrag(x, y) {
  445.     gnLastScrollbarWidthRequest = x;
  446. }
  447.  
  448.  
  449. function IsHideNavEnabledForRemoteURL() {
  450.     if (gbIE) {
  451.         return true;
  452.     } else {
  453.         return false;
  454.     }
  455. }
  456.  
  457. function IsHideNavEnabled() {
  458.     // We should always be able to resize and thus hide the navpane
  459.     return true;
  460. }
  461.  
  462.  
  463. function DoCommand(cmd, param1, param2) {
  464.     switch (cmd) {
  465.         case "CmdCurrentNav":
  466.             gsDefaultTab = param1;
  467.             break;
  468.             
  469.         case "CmdSkinSwfLoaded":
  470.             gbSkinLoaded = true;
  471.             break;
  472.  
  473.         case "CmdTopicIsLoaded":
  474.         case "CmdTopicDisplayed":
  475.         case "CmdTopicUnloaded":
  476.             SendCmdToMasterHTML(cmd, param1, param2);
  477.             break;
  478.             
  479.         case "CmdSyncTOC":
  480.             // Store the information in case it is requested later
  481.             gsTOCSyncInfo = param1;
  482.  
  483.             // Send it off
  484.             SendCmdToMasterHTML(cmd, param1, param2);
  485.             break;
  486.             
  487.         case "CmdSyncInfo":
  488.             // Store the information in case it is requested later
  489.             gsTOCSyncInfo = param1;
  490.             break;
  491.  
  492.         case "CmdBrowseSequenceInfo":
  493.             // Store the information in case it is requested later
  494.             gsBrowseSequenceInfo = param1;
  495.             
  496.             // Send it off
  497.             SendCmdToMasterHTML(cmd, param1, param2);
  498.             break;
  499.             
  500.         case "CmdGetBrowseSequenceInfo":
  501.             // Send it off
  502.             SendCmdToMasterHTML("CmdBrowseSequenceInfo", gsBrowseSequenceInfo);
  503.             break;
  504.  
  505.         case "CmdTopicBGColor":
  506.             // Store the information in case it is requested later and send it off
  507.             gnTopicBGColor = param1;
  508.             SendCmdToMasterHTML(cmd, param1, param2);
  509.             break;
  510.  
  511.         case "CmdGetTopicBGColor":
  512.             SendCmdToMasterHTML("CmdTopicBGColor", gnTopicBGColor);
  513.             break;
  514.                                 
  515.         case "CmdGetSkinFilename":
  516.             SendCmdToMasterHTML("CmdSkinFilename", gsActiveSkinFileName);
  517.             break;
  518.  
  519.         case "CmdDisplayTopic":
  520.             // Navigate to the proper HTML file
  521.             NavigateToTopic(param1, param2);
  522.             break;
  523.  
  524.         case "CmdHideNavigation":
  525.             ShowNavigationPane(false);
  526.             break;
  527.     
  528.         case "CmdGetToolbarOrder":
  529.             gbToolBarLoaded = true;
  530.             CheckForPrint();
  531.             SendCmdToMasterHTML("CmdToolbarOrder", gsToolbarOrder);
  532.             break;
  533.  
  534.         case "CmdGetNavbarOrder":
  535.             SendCmdToMasterHTML("CmdNavbarOrder", gsNavigationElement);
  536.             break;
  537.  
  538.         case "CmdShowNavigation":
  539.             ShowNavigationPane(true);
  540.             break;
  541.         
  542.         case "CmdGetSyncTOC":
  543.             SendCmdToMasterHTML("CmdSyncTOC", gsTOCSyncInfo, 0);
  544.             break;
  545.         
  546.         case "CmdIsAutoSyncTOCEnabled":
  547.             SendCmdToMasterHTML("CmdAutoSyncTOCEnabled", gbAutoSync);
  548.             break;
  549.             
  550.         case "CmdGetDefaultNav":
  551.             SendCmdToMasterHTML("CmdSelectItem", gsDefaultTab, param1);
  552.             break;
  553.         
  554.         case "CmdSetFocus":
  555.         
  556.             if (param1 == "Navigation") {
  557.                 if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"])
  558.                 {
  559.                     if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF) {
  560.                         if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF.focus)
  561.                         {
  562.                             window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF.focus();
  563.                         }
  564.                     }
  565.                 }
  566.             } else if (param1 == "Topic") {
  567.                 window.frames["Content"].frames["bottom"].frames["Topic Pane"].focus();
  568.             }
  569.             break;
  570.         
  571.         case "CmdPrint":
  572.             PrintCurrent();
  573.             break;
  574.                                     
  575.         case "CmdInvokePoweredBy":
  576.  
  577.             // Create a centered window
  578.             var left = (screen.width / 2) - 200;
  579.             var top = (screen.height / 2) - 200;
  580.             var width = 300;
  581.             var height = 200;
  582.             if ((gbNav) && (gbNav4) && (!gbNav6)) {
  583.                 width += 10;
  584.                 height += 10;
  585.             }
  586.  
  587.             // Open the window if it is not already open
  588.             if ((gPoweredByWindow == null) || (gPoweredByWindow.closed == true)) {
  589.             
  590.                 // Create the parameter list
  591.                 var param_str = "uniqueHelpID=" + UniqueID();
  592.                 param_str += "&pbpoweredby=" + gsFlashHelpVersion;
  593.                 param_str += "&pbgeneratedby=" + gsGeneratorVersion;
  594.                 param_str += "&pbaboutlabel="+param1;
  595.                 
  596.                 // Take different action depending on the browser
  597.                 if ((gbIE5 && gbWindows) && (!gbOpera)) {
  598.                     height += 30;
  599.                     var strWindow = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;resizable:no;status:no;scroll:no;help:no;center:yes;';
  600.                     gPoweredByWindow = window.showModelessDialog("wf_poweredby.htm", param_str, strWindow);
  601.  
  602.                 } else if (gbNav4 && !gbNav6) {
  603.                 
  604.                     // For NS 4, we need to use setTimeout. After changing to use fscommand to communicate with NS 4 from Flash,
  605.                     // NS 4 will not perform a window.open of an HTML file during the processing of an fscommand.
  606.                     var strURL = "wf_poweredby.htm?" + param_str;
  607.                     var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
  608.                     setTimeout("window.open('" + strURL + "', 'PoweredByWindow', '" + strWindow + "')", 100);
  609.                     
  610.                 } else if (gbIE4 && !gbIE5) {
  611.  
  612.                     // Create the window string and add the parameters to the filename
  613.                     var strURL = "wf_poweredby.htm#" + param_str;
  614.                     var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
  615.                     gPoweredByWindow = window.open(strURL, 'PoweredByWindow', strWindow);
  616.                 } else {
  617.                     // Create the window string and add the parameters to the filename
  618.                     var strURL = "wf_poweredby.htm?" + param_str;
  619.                     var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
  620.                     gPoweredByWindow = window.open(strURL, 'PoweredByWindow', strWindow);
  621.                 }
  622.             } else if (gPoweredByWindow != null) {
  623.                 gPoweredByWindow.focus();
  624.             }
  625.             break;
  626.             
  627.         case "CmdAskIsTopicOnly":
  628.             param1.isTopicOnly=false;
  629.             break;
  630.             
  631.         case "CmdScrollbarDragStart":
  632.             ScrollbarDragStart(Number(param1), Number(param2));
  633.             break;
  634.             
  635.         case "CmdScrollbarDragStop":
  636.             ScrollbarDragStop(Number(param1), Number(param2));
  637.             break;
  638.             
  639.         case "CmdScrollbarDragMove":
  640.             ScrollbarDrag(Number(param1), Number(param2));
  641.             break;
  642.         
  643.         case "CmdIsNavResizeVisible":
  644.             SendCmdToMasterHTML("CmdNavResizeVisible",     (gbNav4 || gbOpera) ? 1 : 0);
  645.             break;
  646.  
  647.         case "CmdNavigationCleanupComplete":
  648.             // Cleanup finished - we can now reload
  649.             gbNavPaneLoaded = false;
  650.             if (gbReloadNavigationOnly) {
  651.                 window.frames["Content"].frames["bottom"].frames["Navigation Pane"].window.location.reload();
  652.                 gbReloadNavigationOnly = false;
  653.             } else {
  654.                 window.frames["Content"].frames["bottom"].window.location.reload();
  655.             }
  656.             break;
  657.         case "CmdNavigationPaneLoaded":
  658.             gbNavPaneLoaded = true;
  659.             break;            
  660.         case "CmdUILoadFailure":
  661.             // Inform the user and load the plain HTML version of the help system
  662.             alert(param1 + " failed to load the following components:\n" + param2 + "\nThe non-Flash version of the help system will be displayed.");
  663.             window.location.replace("wf_njs.htm");
  664.             break;
  665.         
  666.         case "CmdReloadNavigation":
  667.             ReloadNavigation();
  668.             break;
  669.  
  670.         case "CmdCanFocusBeSet":
  671.             SendCmdToMasterHTML("CmdFocusCanBeSet", ((gbIE && !gbMac) ? true : false));
  672.             break;
  673.         
  674.         case "CmdIsHideNavEnabled":
  675.             SendCmdToMasterHTML("CmdHideNavEnabled", IsHideNavEnabled());
  676.             break;
  677.         
  678.         case "CmdIsHideNavEnabledForRemoteURL":
  679.             SendCmdToMasterHTML("CmdHideNavEnabledForRemoteURL", IsHideNavEnabledForRemoteURL());
  680.             break;
  681.         
  682.         default:
  683.             // See if this is a debug command and send it along to the master
  684.             if (cmd.substr(0, 6) == "debug:") {
  685.                 SendCmdToMasterHTML(cmd, param1, param2);
  686.             }
  687.             break;
  688.     }
  689. }
  690.  
  691. // Create a unique string to ID this instance of the help system
  692. function UniqueID() {
  693.     return UniqueIDString;
  694. }
  695.  
  696. function TestLoaded(bVert) {
  697.     gbAutoSync = 1;
  698.     gsNavigationElement="Previous|Next|Sync TOC|Hide";
  699.     gsToolbarOrder="Contents|Index|Search|Glossary|Print|SearchInput|Logo/Author";
  700.     gsDefaultTab="Index";
  701.     gsActiveSkinFileName = "skin.xml";
  702.     gsFlashHelpVersion="FlashHelp 1.5";
  703.     gsGeneratorVersion="RoboHelp XX";
  704.     DoCommand("CmdSetFocus","Navigation");
  705. }
  706.  
  707. // Send the first command - setting the skin filename to the master
  708. function Loaded() {
  709. //    SendCmdToMasterHTML("CmdSkinFilename", gsActiveSkinFileName);
  710.     // Reset the CurFrameset Col & Row because opera will not do this on reload
  711.     gsCurFramesetCol = gsDefaultFramesetCol;
  712.     gsCurFramesetRow = gsDefaultFramesetRow
  713.  
  714.     DoCommand("CmdSetFocus","Navigation");
  715. }
  716.  
  717.  
  718.  
  719. var gnPans=2;
  720. var gsTopic="%%%WH_PROJECT_DEFAULT_TOPIC%%%";
  721.  
  722. var gsAutoSync="%%%WH_USER_OPTIONS.autosync_toc%%%";
  723. var gbAutoSync = (gsAutoSync == "1") ? 1 : 0;
  724.  
  725. var gsNavigationElement="%%%WFT_NAVIGATION_ELEMENT%%%";
  726. var gsToolbarOrder="%%%WFT_TOOLBAR_ORDER%%%";
  727. var gsDefaultTab="%%%WFT_TOOLBAR_DEFAULT_TAB%%%";
  728. var gsActiveSkinFileName="%%%WFT_ACTIVE_SKIN_FILE_NAME%%%";
  729. var gsLowCaseFileName="%%%WH_USER_OPTIONS.lowcase_fileName%%%";
  730. var gsFlashHelpVersion="%%%WFT_FLASHHELP_VERSION%%%";
  731. var gsGeneratorVersion="%%%WFT_GENERATOR_VERSION%%%";
  732. var gsResFileName="%%%WILDFIRE_RES_XML%%%";
  733. var gsToolbarPaneHeight="%%%WFT_TOOLBAR_PANE_HEIGHT%%%";
  734.  
  735. // Set a default topic for testing
  736. if (gsTopic.substr(0, 2) == "%%") {
  737.     gsTopic = "wf_topic.htm";
  738. }
  739.  
  740. if (gsToolbarPaneHeight.substr(0, 2) == "%%") {
  741.     gsToolbarPaneHeight = "50";
  742. }
  743.  
  744. // Don't show the navigation pane if there is nothing to show
  745. if ((gsToolbarOrder.substr(0, 2) != "%%") &&
  746.     (gsToolbarOrder.indexOf('Contents') == -1) &&
  747.     (gsToolbarOrder.indexOf('Index') == -1) &&
  748.     (gsToolbarOrder.indexOf('Search') == -1) &&
  749.     (gsToolbarOrder.indexOf('Glossary') == -1)) {
  750.     
  751.     if (gbVertical) {
  752.         gsCurFramesetRow = "0, *";
  753.     } else {
  754.         gsCurFramesetCol = "0, *";
  755.     }
  756. }
  757.  
  758.  
  759. // Remove the "print" button as a possibility if the print function is not supported
  760. function CheckForPrint() {
  761.     if (!window.print || (gbMac && (gbNav6 && !gbNav7)) || gbOpera) {
  762.         var iPrint = gsToolbarOrder.indexOf("Print");
  763.         if (iPrint != -1) {
  764.             var sNewOrder = gsToolbarOrder.substr(0, iPrint);
  765.             if (gsToolbarOrder.length > iPrint + 5) {
  766.                 sNewOrder += gsToolbarOrder.substr(iPrint + 6, gsToolbarOrder.length);
  767.             }
  768.             gsToolbarOrder = sNewOrder;
  769.         }
  770.     }
  771. }
  772.  
  773.     
  774. if (location.hash.length > 1)
  775. {
  776.     if (location.hash.indexOf("#<") == 0)
  777.     {
  778.         document.location = "whcsh_home.htm#" + location.hash.substring(2);
  779.     }
  780.     else if (location.hash.indexOf("#>>") == 0)
  781.     {
  782.         parseParam(location.hash.substring(3));
  783.     }
  784.     else
  785.     {
  786.         var nPos = location.hash.indexOf(">>");
  787.         if (nPos>1)
  788.         {
  789.             gsTopic = location.hash.substring(1, nPos);
  790.             parseParam(location.hash.substring(nPos+2));
  791.         }
  792.         else
  793.             gsTopic = location.hash.substring(1);
  794.  
  795.     }
  796.     if (gnPans == 1 && gsTopic)
  797.     {
  798.         var strURL=location.href;
  799.         if (location.hash)
  800.         {
  801.             var nPos=location.href.indexOf(location.hash);
  802.             strURL=strURL.substring(0, nPos);
  803.         }
  804.         if (gbHasTitle)
  805.             document.location=_getPath(strURL)+ "/*% SF_TOPIC_WINDOW %*/" + location.hash;
  806.         else
  807.             document.location=_getPath(strURL)+ gsTopic;
  808.     }
  809. }
  810.  
  811. function parseParam(sParam)
  812. {
  813.     if (sParam)
  814.     {
  815.         var nBPos=0;
  816.         do 
  817.         {
  818.             var nPos=sParam.indexOf(">>", nBPos);
  819.             if (nPos!=-1)
  820.             {
  821.                 if (nPos>0)
  822.                 {
  823.                     var sPart=sParam.substring(nBPos, nPos);
  824.                     parsePart(sPart);
  825.                 }
  826.                 nBPos = nPos + 2;
  827.             }
  828.             else
  829.             {
  830.                 var sPart=sParam.substring(nBPos);
  831.                 parsePart(sPart);
  832.                 break;
  833.             }
  834.         } while(nBPos < sParam.length);
  835.     }    
  836. }
  837.  
  838. function parsePart(sPart)
  839. {
  840.     if(sPart.toLowerCase().indexOf("cmd=")==0)
  841.     {
  842.         gnCmd=parseInt(sPart.substring(4));
  843.         if(gnCmd == CMD_SHOWTOC)
  844.             gsDefaultTab="Contents";
  845.         else if(gnCmd == CMD_SHOWINDEX)
  846.             gsDefaultTab="Index";
  847.         else if(gnCmd == CMD_SHOWSEARCH)
  848.             gsDefaultTab="Search";
  849.         else if(gnCmd == CMD_SHOWGLOSSARY)
  850.             gsDefaultTab="Glossary";
  851.     }
  852.     else if(sPart.toLowerCase().indexOf("cap=")==0)
  853.     {
  854.         document.title=_browserStringToText(sPart.substring(4));
  855.         gbHasTitle=true;
  856.     }
  857.     else if(sPart.toLowerCase().indexOf("pan=")==0)
  858.     {
  859.         gnPans=parseInt(sPart.substring(4));
  860.     }
  861.     else if(sPart.toLowerCase().indexOf("pot=")==0)
  862.     {
  863.         gnOpts=parseInt(sPart.substring(4));
  864.     }
  865.     else if(sPart.toLowerCase().indexOf("pbs=")==0)
  866.     {
  867.         var sRawBtns = sPart.substring(4);
  868.         var aBtns = sRawBtns.split("|");
  869.         for (var i=0;i<aBtns.length;i++)
  870.         {
  871.             aBtns[i] = transferAgentNameToPaneName(aBtns[i]);
  872.         }
  873.         gsRawBtns = aBtns.join("|");
  874.     }
  875.     else if(sPart.toLowerCase().indexOf("pdb=")==0)
  876.     {
  877.         gsDefaultBtn=transferAgentNameToPaneName(sPart.substring(4));
  878.     }
  879. }
  880.  
  881. function transferAgentNameToPaneName(sAgentName)
  882. {
  883.     if (sAgentName =="toc")
  884.         return "toc";
  885.     else if    (sAgentName =="ndx")
  886.         return "idx";
  887.     else if    (sAgentName =="nls")
  888.         return "fts";
  889.     else if    (sAgentName =="gls")
  890.         return "glo";
  891.     return "";
  892. }
  893.